In an expression like 34.12 / 68.0 how do you know if the / means "integer division" or means "floating point division" ?

A good answer might be:

You look at the operands of the operator.


Mixed Floating Point and Integer Expressions

But what if one operand is an integer and the other is a floating point? The rule is:

If both operands are integer, then the operation is an integer operation. If one or two operands is floating point, then the operation is floating point.

For example, the following are integer operations (assume that a and b are int variables):

12 * b a - 2 56%a

Each operation in the following expressions is a floating point operation (assume that a and b are int variables, and that x and y are floating point variables):

x * b (a - 2.0) 56*y

In more complicated expressions, an operand of a particular operator might be a subexpression. But the rule still applies: if one or both operand is a floating point type then the operation is floating point. In the following, each / operation is floating point:

(12.0 * 31) / 12 (a - 2.0) / b 56*x/3

In that last example, the 56*x is a floating point subexpression that is one of the operands for the division operator. (Because * and / have equal precedence, so evaluation is done from left to right.)

QUESTION 8:

What type (integer or floating point) of operator is the / in the following:

(12 + 0.0) / 7